package client;

import java.io.InputStream;
import java.util.Properties;

import javax.naming.InitialContext;
import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;

import service.ServiceLieuDao;

public class TestServiceJUnit {

	private Properties props;
	private InitialContext ic;
	private ServiceLieuDao serviceLieuDao;

	@Before
	public void setUp() throws Exception {

		props = new Properties();
		InputStream lectureProps = TestServiceDao.class
				.getResourceAsStream("../client_jndi.properties");
		try {
			props.load(lectureProps);
			ic = new InitialContext(props);

			serviceLieuDao = (ServiceLieuDao) ic
					.lookup("org.bovoyage/ServiceLieuDaoBean/remote");

		} catch (Exception e1) {
			e1.printStackTrace();
			return;
		}
	}

	@Test
	public void serviceLieuDao() {
		Assert.assertEquals("Régis", serviceLieuDao.getAuteur());
	}
	
	

}
